class Car:
    # 类属性
    wheels = 4  # 所有汽车都有4个轮子

    def __init__(self, brand, model):
        # 实例属性
        self.brand = brand
        self.model = model

    def display_info(self):
        print(f"This is a {self.brand} {self.model} with {Car.wheels} wheels.")

# 创建Car类的实例
car1 = Car("Toyota", "Corolla")
car2 = Car("Honda", "Civic")

# 访问类属性
print(f"All cars have {Car.wheels} wheels.")  # 输出: All cars have 4 wheels.

# 访问实例属性
car1.display_info()  # 输出: This is a Toyota Corolla with 4 wheels.
car2.display_info()  # 输出: This is a Honda Civic with 4 wheels.

# 修改类属性
Car.wheels = 6
print(f"Now all cars have {Car.wheels} wheels.")  # 输出: Now all cars have 6 wheels.

# 再次访问实例属性
car1.display_info()  # 输出: This is a Toyota Corolla with 6 wheels.
car2.display_info()  # 输出: This is a Honda Civic with 6 wheels.